#!/usr/bin env python3
# filename: forms.py

from __future__ import unicode_literals
from flask_wtf import FlaskForm
from wtforms import RadioField, SubmitField, StringField, PasswordField, IntegerField
from wtforms.validators import DataRequired, Length


class ToDoListForm(FlaskForm):
    title = StringField("描述", validators=[DataRequired(), Length(1, 64)])
    status = RadioField("是否完成", validators=[DataRequired()], choices=[("1", "是"), ("0", "否")])
    submit = SubmitField("添加")


class LoginForm(FlaskForm):
    username = StringField("登陆名", validators=[DataRequired(), Length(1, 20)])
    password = PasswordField("密码", validators=[DataRequired(), Length(1, 20)])
    submit = SubmitField("登陆")


class CheckMailForm(FlaskForm):
    mail_id = IntegerField("Mail Id", validators=[DataRequired(), ])
    submit = SubmitField("Check")


class RegisterForm(FlaskForm):
    username = StringField("用户名", validators=[DataRequired(), Length(6, 20)])
    password = PasswordField("密码", validators=[DataRequired(), Length(6, 20)])
    validcode = IntegerField("验证码", validators=[DataRequired()])
    submit = SubmitField("注册")